< previous page page_639 next page >

Page 639
Set cn = New ADODB.Connection
cn.ConnectionString = "DSN=BIBLIO"
cn.Open
Set rs.ActiveConnection = cn
Finally, execute the code that actually performs the database update:
rs.MarshalOptions = adMarshalModifiedOnly
rs.UpdateBatch
I hope you were watching closely because I just introduced a new property, MarshallOptions. This property determines whether the whole recordset is returned for updating or just the changed records, for the most efficient use of resources. The second line of code actually performs the update with the UpdateBatch method.
Uses of a Disconnected Recordset
Now that you know what a disconnected recordset is, you may be wondering why you would ever want to use one. In a traditional client/server environment, it might never be necessary. However, disconnected recordsets bring a whole new level of power to your Internet applications. Imagine being able to run a Visual Basic program inside a browser that communicates with your database server just as you would over a LAN. To build such a heavy-duty application, you need to break it up into the following components:
Internet client. An ActiveX OCX or ActiveX Document that runs in Internet Explorer
Internet Server. An ActiveX DLL component running on the Internet server
Creating an application that works in this manner involves understanding several fairly complex Microsoft productscoverage of which is beyond the scope of this chapter. However, if you understand a few key concepts (ADO and ActiveX components), you should be successful.
Microsoft offers a product called Remote Data Services (RDS), which acts as a link between Internet Information Server and Internet Explorer. The key to using RDS is its DataSpace object. You can create an instance of the RDS Data Space on the Internet client, as follows:
Set objRDS = CreateObject("RDS.DataSpace")
You can then use the RDS Data Space to create remote objects on a Web server:
Set objTest = objRDS.CreateObject("MyDLL.MyClass", _
"http://server.somewhere.com")
Notice the difference in the two calls to CreateObject. The first line of code creates a local object. The second line of code creates a remote object, objTest. This process is somewhat similar (but not exactly like) using DCOM to create an instance of an object on a remote machine, but then using the features of that object on a local machine.
The sample object objTest is an instance of an ActiveX DLL that runs on the Web server. After you create this instance, you can make method calls and pass data to and from it. The ADOR object library mentioned earlier is a minimal implementation of an ADO Recordset (the R stands for remote) designed for this type of use. You can create functions in your ActiveX DLL to pass ADOR recordsets to the Internet client, which can then return the changed records to the server.

 
< previous page page_639 next page >